package com.design.myiterator.library;

import java.util.ArrayList;
import java.util.List;

/**
 * @author xiemiao
 * @description 图书馆类
 * @date 2023/08/14
 */
public class Library implements Iterable<Book> {
    private List<Book> books = new ArrayList<>();

    public void addBook(Book book) {
        books.add(book);
    }

    @Override
    public Iterator<Book> iterator() {
        return new BookIterator(books);
    }
}
